package com.wad.utils;

import com.wad.entity.system.SysUser;

/**
 * @author wad
 * @date 2023/11/30 14:03
 * @project e-commerce
 **/
public class AuthContextUtil {

    //创建一个ThreadLocal对象
    private static final ThreadLocal<SysUser> threadLocal=new ThreadLocal<>();
    //添加数据
    public static void set(SysUser sysUser){
        threadLocal.set(sysUser);
    }
    //获取数据
    public static SysUser get(){
        return threadLocal.get();
    }

    //删除数据

    public static void remove(){
        threadLocal.remove();
    }
}
